import gtk
import gtk.glade
import gobject

class CancelBuildersWin():
    def __init__( self, gladefile, wizard, runningBuilders):
        self.__wiz = wizard
        self.__gladeFile = gladefile
        self.__builders = runningBuilders
        self.__xml = gtk.glade.XML( self.__gladeFile)
        if self.__xml:
            self.__win = self.__xml.get_widget( "CancelBuildersWin")
            self.__win.connect( "destroy", self.__onCancel)
            self.__handlers = { "on_btnOK_clicked": self.__onOK
                              , "on_btnAll_clicked": self.__onSelectAll
                              , "on_btnCancel_clicked": self.__onCancel }
            self.__xml.signal_autoconnect( self.__handlers)
            self.__treeStore = gtk.TreeStore( gobject.TYPE_STRING)
            for name in self.__builders:
                self.__treeStore.append( None, (name))

            self.__win.treeview = self.__xml.get_widget( "treeviewPlatforms")
            self.__win.treeview.set_model( self.__treeStore) 

            # 'Platform' column
            self.__rendererPlatform = gtk.CellRendererText()
            self.__platfColumn = gtk.TreeViewColumn( "PLATFORM"
                                                   , self.__rendererPlatform
                                                   , text=0)
       
            self.__win.treeview.append_column( self.__platfColumn)
            self.__win.treeview.set_search_column( 0)
            self.__platfColumn.set_sort_column_id( 0)

    def __onOK( self, button):
        #self.__wiz.
        return

    def __onSelectAll( self, button):
        return

    def __onCancel( self, button):
        self.__win.destroy()
        return

